﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ucUser.ascx.cs" Inherits="PhotoList.Web.Admin.ucUser" %>

<style type="text/css">
.tbAdd
{
	margin:5px 0;
}

.tbAdd td
{
	height:30px;
}

.tbAdd .btn
{
	margin:15px 10px;
}
</style>

<script type="text/javascript" language="javascript">
    var cao_x, cao_y;

    function caoMove(obj)  //实现层的拖移
    {
        if (event.button == 1) {
            var caoX = obj.clientLeft;
            var caoY = obj.clientTop;
            obj.style.pixelLeft = caoX + (event.x - cao_x);
            obj.style.pixelTop = caoY + (event.y - cao_y);
        }
    }

    function closeDiv(id) {
        document.getElementById(id).style.display = "none";
    }
</script>

<table border="0" cellpadding="0" cellspacing="0" width="100%" id="Func">
    <tr>
        <td align="left"><asp:Button ID="btnOpen" runat="server" OnClick="btnOpen_Click" Text="添加用户" CssClass="btn" /></td>
    </tr>
</table>

<asp:GridView ID="gvList" runat="server" AutoGenerateColumns="false" Width="100%" CssClass="tbList" BorderColor="Black">
    <HeaderStyle HorizontalAlign="center" />
    <RowStyle HorizontalAlign="center" />
    <Columns>
        <asp:BoundField DataField="id" DataFormatString="&lt;input type=&quot;checkbox&quot; id=&quot;iptselect&quot; name=&quot;iptselect&quot; value=&quot;{0}&quot; onclick=&quot;checkAllYes('iptselect','checkbox')&quot; /&gt;" HeaderText="&lt;input type=&quot;checkbox&quot; id=&quot;checkbox&quot; onclick=&quot;checkEvent('iptselect','checkbox')&quot; /&gt;全选" HtmlEncode="false" HeaderStyle-Width="10%" />
        <asp:TemplateField HeaderText="序号" HeaderStyle-Width="10%">
            <ItemTemplate>
                <%# this.gvList.Rows.Count + 1%> 
            </ItemTemplate>
        </asp:TemplateField>
        <asp:BoundField DataField="userid" HeaderText="账号" HeaderStyle-Width="20%" />
        <asp:BoundField DataField="name" HeaderText="姓名" HeaderStyle-Width="20%" />
        <asp:BoundField DataField="home" HeaderText="主目录" HeaderStyle-Width="20%" />
        <asp:TemplateField HeaderText="操作">
            <ItemTemplate>
                <asp:LinkButton ID="lbModi" runat="server" OnClick="lbModi_Click" CommandArgument='<%#Eval("userid") %>' Text="修改"></asp:LinkButton> |
                <asp:LinkButton ID="lbDele" runat="server" OnClick="lbDele_Click" CommandArgument='<%#Eval("userid") %>' OnClientClick="if(confirm('您确定要删除吗？')) return true; else return false;" Text="删除"></asp:LinkButton> |
                <asp:LinkButton ID="lbPass" runat="server" OnClick="lbPass_Click" CommandArgument='<%#Eval("userid") %>' Text="密码"></asp:LinkButton>
            </ItemTemplate>
            <HeaderStyle Width="20%" />
        </asp:TemplateField>
    </Columns>
</asp:GridView>

<!--以下为弹窗效果区-->
<div id='divAdd' runat="server" style='font-size:14px;position:absolute;text-align:center;overflow:visible' visible="false">
    <div style='position:fixed;top:50px;left:300px;width:400px;background-color:#dbdbdb;border:1px solid #cccccc;'>
        <table border="0" cellpadding="0" cellspacing="0" width="100%" style="margin:1px 1px 2px 1px; padding:5px 0; cursor:move;" onmousedown='cao_x=event.x-parentNode.style.pixelLeft;cao_y=event.y-parentNode.style.pixelTop;setCapture();' onmouseup='releaseCapture();' onmousemove='caoMove(this.parentNode)'>
            <tr style="height:25px; background-color:Gray;">
                <th style="width:20%;"></th>
                <th style="width:60%;"><asp:Label ID="lblTitle" runat="server">添加新用户</asp:Label></th>
                <th style="width:20%; text-align:right;"></th>
            </tr>
        </table>
        <table border="0" cellpadding="0" cellspacing="0" width="100%" class="tbAdd">
        <tbody> 
            <tr>
                <td style="width:35%; text-align:right;">账号：</td>
                <td style="width:65%; text-align:left;"><asp:TextBox ID="tbUserid" runat="server" Width="100" BorderStyle="Dotted" BorderWidth="1" Height="20"></asp:TextBox></td>
            </tr>
            <tr>
                <td style="text-align:right;">密码：</td>
                <td style="text-align:left;"><asp:TextBox ID="tbPass" runat="server" TextMode="Password" Width="100" BorderStyle="Dotted" BorderWidth="1" Height="20"></asp:TextBox></td>
            </tr>
            <tr>
                <td style="text-align:right;">用户组：</td>
                <td style="text-align:left;">
                    <asp:DropDownList ID="ddlGourp" runat="server">
                        <asp:ListItem Value="User" Text="普通用户"></asp:ListItem>
                        <asp:ListItem Value="Root" Text="管理员"></asp:ListItem>
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td style="text-align:right;">主目录：</td>
                <td style="text-align:left;"><asp:TextBox ID="tbHome" runat="server" Width="200" BorderStyle="Dotted" BorderWidth="1" Height="20"></asp:TextBox></td>
            </tr>
            <tr>
                <td style="text-align:right;">姓名：</td>
                <td style="text-align:left;"><asp:TextBox ID="tbName" runat="server" Width="100" BorderStyle="Dotted" BorderWidth="1" Height="20"></asp:TextBox></td>
            </tr>
            <tr>
                <td colspan="2" align="center">
                    <asp:Button ID="btn_OK" runat="server" Text="确定" OnClick="btn_OK_Click" CssClass="btn" Visible="false" />
                    <asp:Button ID="btn_Modi" runat="server" Text="确定" OnClick="btn_Modi_Click" CssClass="btn" Visible="false" />
                    <input type="button" value="取消" onclick="document.getElementById('<%=divAdd.ClientID %>').style.display='none';" class="btn" />
                </td>
            </tr>
        </tbody>       
        </table>
    </div>
</div>
<!--弹窗效果结束-->
